=Build Linux Environment=

==Preparation==
Change directory to a directory you want to use, and set WORKING_DIRECTORY to it: (e.g. use /home/user/cpss as working directory)
<pre>
export WORKING_DIRECTORY=/home/user/cpss
</pre>

Create some directory for building:
<pre>
mkdir -p archives linux lsp
</pre>

Get compiler package armv7-marvell-linux-gnueabi-softfp_i686_201201.tar.bz2, save it into archives directory, and extract it to /opt:
<pre>
tar -xf archives/armv7-marvell-linux-gnueabi-softfp_i686_201201.tar.bz2 -C /opt
</pre>

Setup compiler environment:
<pre>
export PATH=/opt/Marvell_toolchain_201201/armv7-marvell-linux-gnueabi-softfp_i686/bin:$PATH
export CROSS_COMPILE=/opt/Marvell_toolchain_201201/armv7-marvell-linux-gnueabi-softfp_i686/bin/arm-marvell-linux-gnueabi-
export ARCH=arm
</pre>

==Build kernel==
Get linux-3.10.70.tar.xz for kernel.org, save it into archives directory. Then extract it:
<pre>
tar -xf archives/linux-3.10.70.tar.xz
mv linux-3.10.70 kernel
</pre>

Extract linux-3.10.70-2015_T1.2p15.zip from lsp package, and save it into lsp directory. Then extract it into kernel directory:
<pre>
cd kernel
unzip -o ../lsp/linux-3.10.70-2015_T1.2p15.zip
</pre>

Build kernel:
<pre>
make mrproper
make mvebu_lsp_defconfig
make LOCALVERSION= zImage -j4
make armada-370-rd.dtb
</pre>

=Burn files into main board=

==Burn into SPI NOR Flash==

Partition structure:
<pre>
0x0000000--0x0F00000 uboot
0x00f0000--0x0100000 uboot env
0x0100000--0x0900000 kernel
0x0900000--0x0910000 device tree
0x0920000--0x1900000 rootfs
0x1900000--0x2000000 app-jffs2
</pre>

Probe SPI Flash:
<pre>
sf probe
</pre>

Burn u-boot:
Send u-boot image from PC UART in 115200bps, 8N1, X-Modem mode
<pre>
loadx 0x02000000
sf write 0x02000000 0x0 0x100000
</pre>

Burn kernel:
Send kernel image from PC UART in 115200bps, 8N1, X-Modem mode
<pre>
loadx 0x02000000
sf write 0x02000000 0x100000 0x500000
</pre>

Burn device tree:
Send device tree file from PC UART in 115200bps, 8N1, X-Modem mode
<pre>
loadx 0x02000000
sf write 0x02000000 0x900000 0x4000
</pre>


Burn rootfs:
Send rootfs image from PC UART in 115200bps, 8N1, X-Modem mode
<pre>
loadx 0x02000000
sf write 0x02000000 0x920000 0x1400000
</pre>

==Burn into NAND Flash==

Partition structure:
<pre>
0x00000000--0x00500000 uboot
0x00500000--0x00510000 uboot env
0x00600000--0x00E00000 kernel
0x00E00000--0x00E40000 device tree
0x00F00000--0x03000000 rootfs
0x03000000--0x20000000 app-yaffs2
</pre>

Earse NAND:
<pre>
nand erase 0 0x20000000
</pre>

Burn u-boot:
Send u-boot image from PC UART in 115200bps, 8N1, X-Modem mode
<pre>
loadx 0x02000000
nand write 0x02000000 0x0 0x100000
</pre>

Burn kernel:
Send kernel image from PC UART in 115200bps, 8N1, X-Modem mode
<pre>
loadx 0x02000000
nand write 0x02000000 0x600000 0x500000
</pre>

Burn device tree:
Send device tree file from PC UART in 115200bps, 8N1, X-Modem mode
<pre>
loadx 0x02000000
nand write 0x02000000 0xE00000 0x40000
</pre>

Burn rootfs:
Send rootfs image from PC UART in 115200bps, 8N1, X-Modem mode
<pre>
loadx 0x02000000
nand erase 0xF00000 0x1400000
nand write 0x02000000 0xF00000 0x1400000
</pre>